package cn.powertime.evaluation.web.controller;

import cn.powertime.evaluation.facade.ZcPolicyFacade;
import cn.powertime.evaluation.vo.PageVo;
import cn.powertime.evaluation.vo.ZcRespListVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 政策宣传表 前端控制器
 * </p>
 *
 * @author liqi
 * @since 2019-09-23
 */
@RestController
@RequestMapping("/web/policy")
@Api(value = "/web/policy", tags = "政策宣传接口", produces = MediaType.ALL_VALUE)
public class ZcPolicyController extends BaseController {

    @Autowired
    private ZcPolicyFacade zcPolicyFacade;

    @ApiOperation(value = "政策宣列表",response = ZcRespListVo.class)
    @PostMapping(value = "/list")
    public Object list(@RequestBody PageVo pageVo) {
        IPage<ZcRespListVo> list = zcPolicyFacade.list(pageVo);
        return success(list);
    }

    @ApiOperation(value = "政策详情", notes = "")
    @GetMapping(value = "/details/{id}")
    public Object details(@PathVariable("id") @NotNull(message = "ID不能为空") Long id) {
        return success(zcPolicyFacade.selectById(id));
    }

}
